package com.xinongbest.mall.controller;

import com.xinongbest.mall.common.ApiRestResponse;
import com.xinongbest.mall.model.dto.OrderRequestDto;
import com.xinongbest.mall.model.pojo.Order;
import com.xinongbest.mall.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

@RestController
@RequestMapping("/order")
public class OrderController {
    @Autowired
    OrderService orderService;

    @PostMapping("/create")
    public ApiRestResponse create(@Valid @RequestBody OrderRequestDto requestDto) {
        String orderNo = orderService.createOrder(requestDto);
        return ApiRestResponse.success(orderNo);
    }

    @GetMapping("/qrcode")
    public ApiRestResponse qrcode(String orderNo) {
        return null;
    }

}
